@echo off

:: 如下命令行会显示当前目录下所有以bat或者txt为扩展名的文件名
for %%c in (*.bat *.txt) do (echo %%c)

for %%c in (bat txt) do (
    echo Files with extension .%%c:
    dir /b *%%c
    echo.
)

:: 如下命令行会显示当前目录下所有包含有 es 或者 it 的目录名。
for /D %%a in (*es* *it*) do (echo %%a)

for %%a in (es it) do (
    echo Processing directories with "%%a":
    for /D %%b in (*%%a*) do (
        echo %%b
    )
    echo.
)

:: 如下命令行会显示E盘test目录下所有以bat或者txt为扩展名的文件名
for /R E:\test %%b in (.txt .bat) do echo %%b
:: 遍历当前目录下所有文件
for /r %%c in (*) do (echo %%c) 


:: 如下命令行将产生序列 1 2 3 4 5
for /L %%c in (1,1,5) do echo %%c


for /F "tokens=1-3 delims=-/. " %%j In ('Date /T') do echo %%j year %%k mon %%l day
for /F "tokens=1,2 delims=: " %%j In ('TIME /T') do echo %%j hour %%k min

for /L %%c in (1,1,5) do echo %%c